package com.kede.app.repository;

import com.kede.app.domain.SysArea;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

/**
* @author Pr.li
* @date 2023-04-19
**/
public interface SysAreaRepository extends JpaRepository<SysArea, Integer>, JpaSpecificationExecutor<SysArea> {

    /**
     * 根据adcode获取
     *
     * @Author: Pr.li
     * @Date: 2023/4/19 15:19
     * @Param: [java.lang.Integer]
     * @Return: com.kede.domain.SysArea
     ***/
    Optional<SysArea> getSysAreaByAdcode(Integer adcode);

    List<SysArea> findAllByPid(Integer pid);


    List<SysArea> findAllByLevelOrderBySort(Integer level);

    List<SysArea> findAllByAdcodeOrderBySort(Integer adcode);

}